// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import GameData_red_blue_man from "./GameData_red_blue_man";
import Music from "../PublicScript/Music";
import Money from "./Money";
import PowerControl from "../PublicScript/PowerControl";

const {ccclass, property} = cc._decorator;

@ccclass
export default class Loading extends cc.Component {

    // onLoad () {
    //
    // }

    start () {
        //获取关卡
        GameData_red_blue_man.highestLevel = GameData_red_blue_man.getGameData();
        // console.log("GameData.highestLevel:", GameData.highestLevel);
        //加载音效
        Music.loadAudioClip(Music.effectList[Music.loadIndext]);
        //加载金币
        Money.newPlay();
        //获取data
        GameData_red_blue_man.initSkinData();
        //获取上一次使用皮肤的编号
        GameData_red_blue_man.initUsingSkinIndex();
        //获取状态
        GameData_red_blue_man.initSettingState();
        //初始化广告
        //初始化gift数据
        GameData_red_blue_man.initGiftCount();
        //初始化彩蛋数据
        GameData_red_blue_man.initEggCount();
        //初始化指导数据
        GameData_red_blue_man.initGuide();
        //初始化体力系统
        PowerControl.initPowerControl();

        this.scheduleOnce(
        ()=>{cc.director.loadScene("Welcome");}, 1)
    }

    // update (dt) {}
}
